In computer science, a virtual machine (VM) is a portion of software that, when executed on appropriate hardware, creates an environment allowing the virtualization of an actual physical computer system. Each VM may function as a self-contained platform, running its own operating system (OS) and software applications (processes). Typically, a virtual machine monitor (VMM) manages allocation and virtualization of computer resources and performs context switching, as may be necessary, to cycle between various VMs.
A host machine (e.g., computer or server) is typically enabled to simultaneously run multiple VMs, where each VM may be used by a remote client. The host machine allocates a certain amount of the host's resources to each of the VMs. Each VM is then able to use the allocated resources to execute applications, including operating systems known as guest operating systems. The VMM virtualizes the underlying hardware of the host machine or emulates hardware devices, making the use of the VM transparent to the guest operating system or the remote client that uses the VM.
One function of the host machine is to manage available memory between the host operating system and the guest operating systems. Memory usage can be generally categorized into two categories: page cache; and anonymous memory. Page cache is a cache of an object stored on a disk. When a file is modified, the new data is stored in page cache before being written back to the disk. When a page in memory has new data that has not yet been “written back,” the page is referred to as “dirty.” Pages not referred to as “dirty” are “clean.” The host machine can reclaim clean pages.
Anonymous memory can refer to a memory allocation that is not associated with an object or file in a known location. Anonymous memory, for example, may be a memory allocation dedicated to one or more VMs. Over time, the guest OS allocates and frees memory, but traditional hypervisors cannot reclaim anonymous memory.